﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BI.CF.BLL;
using BI.CF.Model;
using System.Web.Helpers;
using System.Net;
using System.Data.SqlClient;
using BI.CF.UI.Models;
using System.Net.Sockets;
using BI.CF.PageList;

namespace BI.CF.Company.Controllers
{
    /// <summary>
    /// 还款明细--控制器
    /// </summary>
    public class RepayDetailedController : Controller
    {

        RepayDetailedBLL rbll = new RepayDetailedBLL();
        //
        // GET: /RepayDetailed/

        /// <summary>
        /// 显示需要还款的信息
        /// </summary>
        /// <returns></returns>
        public ActionResult RepayDetailedShow()
        {
            return View();
        }
        /// <summary>
        /// 分页显示信息
        /// </summary>
        /// <returns></returns>
        public string RepayDetailedShowDo()
        {
            //string TimeMin = Request["datemin"].ToString();
            //string TimeMax = Request["datemax"].ToString();
            string TimeMin = null;
            string TimeMax = null;
            int Mid = 1;
            int Uid = 1;
            int PageIndex = 1;
            int PageSize = 10;
            Pager<RepayDetailedModel> list = rbll.ShowRepayDetailed(TimeMin, TimeMax, Mid, Uid, PageIndex, PageSize);
             string str = JsonHelper.JsonSerializer<Pager<RepayDetailedModel>>(list);
             return str;
        }
        /// <summary>
        /// 一次性还清
        /// </summary>
        /// <returns></returns>
        public int UpdateMoney( RepayDetailedModel model)
        {
            if(rbll.update(model) == true)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

        public int RepayDetailedPwd()
        {
            int Uid =Convert.ToInt32(Request["UserId"].ToString());
            int Upwd = Convert.ToInt32(Request["Pwd"].ToString());
            if(rbll.RepayDetailedPwd(Uid,Upwd) == 1)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }


    }
}
